//
//  BGMainTabBarController.m
//  BluetoothCameraHead
//
//  Created by wang on 16/11/1.
//  Copyright © 2016年 BG. All rights reserved.
//

#import "BGMainTabBarController.h"
#import "BGDeviceViewController.h"
#import "BGUpdateViewController.h"
#import "BGEditorViewController.h"
#import "BGClassicalViewController.h"

@interface BGMainTabBarController ()

@property (nonatomic, strong) BGDeviceViewController *deviceVC;
@property (nonatomic, strong) BGUpdateViewController *updateVC;
@property (nonatomic, strong) BGEditorViewController *etitorVC;
@property (nonatomic, strong) BGClassicalViewController *classicVC;

@end

@implementation BGMainTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(instancetype)init
{
    self = [super init];
    if (self) {
        [self addChildController:[[BGDeviceViewController alloc] init] title:@"设备" norImg: @"tabbar_home" selectedImg:@"tabbar_home_selected"];
        
        
        [self addChildController:[[BGEditorViewController alloc] init] title:@"编辑器" norImg:@"tabbar_message_center" selectedImg:@"tabbar_message_center_selected"];
        

        [self addChildController:[[BGUpdateViewController alloc] init] title:@"升级" norImg:@"tabbar_discover" selectedImg:@"tabbar_discover_selected"];
       
        [self addChildController:[[BGClassicalViewController alloc] init] title:@"官网" norImg:@"tabbar_profile" selectedImg:@"tabbar_profile_selected"];
        
    }
    return self;
}

-(void )addChildController :(UIViewController *)controller title:(NSString *)title norImg:(NSString *)img selectedImg:(NSString *)sImg
{
    controller.title = title;
    controller.tabBarItem.image =[UIImage imageNamed:img];
    controller.tabBarItem.selectedImage = [UIImage imageNamed:sImg];
    UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:controller];
    [self addChildViewController:nc];
}


@end
